import './common.scss';

import { BuildComponents, ViewComponents } from './components';
import FormDesign from './MFormDesign';
import FormBuilder from './MFormBuilder';
import FormView from './MFormView';
import FormItem from './MFormItem.vue';
import FormPreview from './MFormPreview';

const Form = {
  install(Vue) {
    const components = { ...BuildComponents, ...ViewComponents };
    Object.keys(components).forEach(name =>
      Vue.component(name, components[name])
    );
    
    Vue.component(FormDesign.name, FormDesign);
    Vue.component(FormBuilder.name, FormBuilder);
    Vue.component(FormView.name, FormView);
    Vue.component(FormItem.name, FormItem);
    Vue.component(FormPreview.name, FormPreview);
  }
};

export default Form;
